import request from '@/utils/request'
/**
 *
 * @param {id,count} param0 添加购物车的商品id和数量
 * @returns Promise
 */
export const insertGoodsToCart = ({ id, count }) => {
    return request('/cart', 'post', {
        goods_id: id,
        number: count,
        uid: JSON.parse(localStorage.useManage).profile.id,
    })
}
/**
 * 提交订单信息
 * @param {string,string} param0 订单总价和订单中的商品
 * @returns
 */
export const sendOrderInfo = ({ totalPrice, orderList }) => {
    return request('/order/save', 'post', {
        totalPrice,
        orderList,
        uid: JSON.parse(localStorage.useManage).profile.id,
    })
}
/**
 *  根据id获取订单信息
 * @param {int} order_id 订单编号
 * @returns
 */
export const findOrderInfoById = order_id => {
    return request('order/find', 'post', {
        order_id,
        uid: JSON.parse(localStorage.useManage).profile.id,
    })
}

export const findOrderAll = () => {
    return request('order/find/all', 'post', {
        uid: JSON.parse(localStorage.useManage).profile.id,
    })
}
